package com.wdb.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wdb.modules.system.domain.Dept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @author: wendaobai@qq.com
 * @date: 2024/1/19 0019 9:58
 */
@Mapper
public interface DeptMapper extends BaseMapper<Dept> {
  Set<Dept> findByRoleId(Long id);

  List<Dept> findByPid(Long id);

  @Select("select d.sub_count from sys_dept d where d.dept_id = #{id}")
  Integer getCountById(@Param("id") Long deptId);

  int countByPid(@Param("pid") Long pid);
}
